arch?= arm
modname?=demo
ifeq ($(arch),arm)
	KERNELDIR:= /home/linux/linux-5.10.61/
else
	KERNELDIR := /lib/modules/$(shell uname -r)/build
endif
PWD:=$(shell pwd)

all:
	make -C $(KERNELDIR) M=$(PWD) modules
install:
	@ cp *.ko  ~/rootfs
clean:
	make -C $(KERNELDIR) M=$(PWD) clean
obj-m:=$(modname).o #当前目录的模块名是demo,编译生成demo.ko